/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Negocio;
/**
  * @author jhow
 */

public class vectorEntero extends Entero {
 private int n ;
    public int getN() {
        return n;
    }

    public void setN(int n) {
        this.n = n;
    }
static final int Max=1000;
private Entero[] V=new Entero[Max];
public boolean Lleno(){
    return n==Max;
}
public boolean Insertar(Negocio.Entero ele){
    if (!this.Lleno()){
    V[n]=ele;
    n++;
    return true;
    }
    else
    {
        return false;
    }
}
    public boolean Insertar(int ele){
    if (!this.Lleno()){
        Entero obj1=new Entero();
        obj1.setNum(ele);
    V[n]=obj1;
    n++;
    return true;
    }
    else
    {
        return false;
    }
    
}
    public Entero LeerVector(int Posicion){
        return V[Posicion];
    }
    private void Intercambiar(Entero a,Entero b){
        Entero aux=new Entero();
        aux.setNum(a.getNum());
        a.setNum(b.getNum());
        b.setNum(aux.getNum());
    }
    public void Ordenar(){
        for(int i=0;i<=n-2;i++){
            for(int j=i+1;j<=n-1;j++){
                if(V[j].getNum()<V[i].getNum()){
                    this.Intercambiar(V[i], V[j]);
                }
            }
        }
    }
    public void InvertirV(){
        for(int i=0;i<=n/2-1;i++){
            this.Intercambiar(V[i], V[(n-1)-i]);
               }
    }
        public boolean Existe(int ele){
        for(int i=0;i<=n-1;i++){
            if(V[i].getNum()==ele){
                return true;
            }
        }
        return false;    
        }
        
        public void eliP(){
            int a=0;
        for(int i=0;i<=n-1;i++){
            Entero objpri=new Entero();
            int x=(V[i].getNum());
            objpri.setNum(x);
           if(objpri.Primo()){
             V[i].setNum(a);
            }
        }
         
        }
        
        
        
    }
